local skel = fk.CreateSkill {
  name = "emo__shixie",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["emo__shixie"] = "拾鞋",
  [":emo__shixie"] = "锁定技，当你因〖认主〗使用的【杀】造成伤害时，若牌堆中有可以置入你装备区的坐骑牌（可替换），你令有“主”标记的角色选一项：1.将此坐骑牌置入你的装备区；2.你失去一点体力，令此伤害值+X（X为受伤角色当前体力值）。",

  ["#emo__shixie_horse"] = "将一张坐骑置入 %dest 的装备区",
  ["#emo__shixie_damage"] = "%dest 失去1点体力，此伤害+%arg",
  ["#emo__shixie-choice"] = "拾鞋：%src 即将受到 %dest 造成的伤害，请选一项",

  ["$emo__shixie1"] = "我是个怪物……",
  ["$emo__shixie2"] = "我……派上用场了吗？",
}

skel:addEffect(fk.DamageCaused, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    if target == player and player:hasSkill(skel.name) and data.card and table.contains(data.card.skillNames, "emo__renzhu")
    and not data.to.dead and player:getMark("emo__renzhu_tar") ~= 0
    and not player.room:getPlayerById(player:getMark("emo__renzhu_tar")).dead then
      local cardId = table.find(player.room.draw_pile, function (id)
        return (Fk:getCardById(id).sub_type == Card.SubtypeOffensiveRide or Fk:getCardById(id).sub_type == Card.SubtypeDefensiveRide)
        and player:canMoveCardIntoEquip(id, true)
      end)
      if cardId then
        event:setCostData(self, {cards = {cardId}})
        return true
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local master = room:getPlayerById(player:getMark("emo__renzhu_tar"))
    local choices = {"#emo__shixie_horse::"..player.id, "#emo__shixie_damage::"..player.id..":"..data.to.hp}
    local choice = room:askToChoice(master, { choices = choices, skill_name = skel.name,
    prompt = "#emo__shixie-choice:"..data.to.id..":"..player.id})
    if choice == choices[1] then
      room:moveCardIntoEquip(player, event:getCostData(self).cards[1], skel.name, true, player)
    else
      data:changeDamage(data.to.hp)
      room:loseHp(player, 1, skel.name)
    end
  end,
})

return skel
